/*
 * @Description: 放大
 */

import BaseCommand from "@/core/Frame/BaseClass/BaseCommand";

class ZoomOutCommand extends BaseCommand {
    viewer: any;
    globeControl: any;
    globe: any;
    //scales:any;
    constructor(params: any) {
        super();
        this.viewer = params.viewer;
        this.globeControl = this.viewer.getGlobeControl();
        this.globe = this.viewer.getGlobe();
        //this.scales = this.globe.getScaleLevels();
    };

    execute(option: any) {
        let scale=this.globe.getScale();
        this.globe.setScale(2*scale);

        // let zoomLevel=this.scales.length;
        // let zoom =this.globe.getZoom();
        // if (zoom < zoomLevel){
        //     ++zoom;
        // }
        // else {
        //     zoom=zoomLevel-1;
        // }
        // try {
        //     this.globe.setZoom(zoom);
        // }
        // catch (e) {
        //     console.log("====",e)
        //     this.globe.setZoom(zoom);
        // }
        this.globe.refresh(false, false);
        option.checked = false;
    };

    release() {
        const { globeControl } = this;
        const { PIE } = window;
        globeControl.setGlobeTool(PIE.GlobeToolType.Pan);
    };

    isEnable(option: any) {
        return true
    };
}

export default ZoomOutCommand
